import React, { Component } from 'react'
// import qs from 'querystring'

const DetailDate = [
    { id: '01', content: "你好哈哈哈，我是01" },
    { id: '02', content: "你好哈哈哈，我是02" },
    { id: '03', content: "你好哈哈哈，我是03" },
]
export default class Detail extends Component {
    render() {

        // 接收params参数
        const { id, title } = this.props.match.params

        // 接收search参数
        // const { search } = this.props.location
        // const { id, title } = qs.parse(search.slice(1))

        // // 接收state参数
        // const { id, title } = this.props.location.state || {}

        const fin = DetailDate.findIndex(item => {
            return item.id === id
        })
        return (
            <div>
                <hr />
                <ul>
                    <li>Id：{id}</li>
                    <li>Title：{title}</li>
                    <li>Content:{DetailDate[fin].content}</li>
                </ul>
            </div>
        )
    }
}
